package org.jwcloud.project.module.zx.txzldp.controller;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import org.jwcloud.project.module.zx.baseManager.service.repository.MatBaseManagerRepository;
import org.jwcloud.project.module.zx.common.FmtUtil;
import org.jwcloud.project.module.zx.common.Resp;
import org.jwcloud.project.module.zx.common.repository.RptCommonRepository;
import org.jwcloud.project.module.zx.common.service.RptUtService;
import org.jwcloud.project.module.zx.txzldp.service.repository.TxzldpCommonViewRepository;
import org.jwcloud.project.module.zx.workTime.service.repository.MatWorkTimeRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.github.pagehelper.PageHelper;
import com.jw.mid.mm.comm.common.controller.BaseController;
import com.jw.mid.mm.comm.common.controller.CrudController;
import com.jw.mid.mm.comm.common.json.Response;
import com.jw.mid.mm.comm.common.pagination.ListBounds;
import com.jw.mid.mm.comm.common.pagination.ListSlice;
import com.jw.mid.mm.comm.common.pagination.PageListSlice;
import com.jw.mid.mm.comm.common.pagination.Pagination;
import com.jw.mid.mm.comm.common.service.CrudService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;

@Api(value = "API - Controlle",
description = "铁西专项大屏", tags = "dp")
@RestController
@Transactional
@RequestMapping("/rest/txzldp/commonView")
public class TxzldpCommonViewController extends BaseController{
	
	@Autowired
	public RptCommonRepository rptCommonRepository;
	
	@Autowired
	public TxzldpCommonViewRepository txzldpCommonViewRepository;
	
	@Autowired
    public RptUtService rptUtService;
	
	//@RequestMapping("/view1")
	public ModelAndView testView(String param, ModelAndView model) {
		model.setViewName("/test/Test.html");
		return model;
	}
	
	@GetMapping("queryDeptSum")
    @ApiOperation(value = "公房、公车、党员、六类", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryDeptSum(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.txzldpCommonViewRepository.queryDeptSum(param));
    }
	
	@GetMapping("queryPie")
    @ApiOperation(value = "公房、公车、党员、六类", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryPie(
    		@RequestParam(required = false) Map<String,String> param
    		){
//		Map res = new HashMap();
//		res.put("list", this.txzldpCommonViewRepository.queryPie(param));
//		res.put("total", this.txzldpCommonViewRepository.queryPieTotal(param));
		return Resp.success(this.txzldpCommonViewRepository.queryPie(param));
    }
	
	@GetMapping("queryQlBar")
    @ApiOperation(value = "权力 分类", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryQlBar(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.txzldpCommonViewRepository.queryQlBar(param));
    }
	
	@GetMapping("queryQlDetail")
    @ApiOperation(value = "权力明细", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryQlDetail(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.rptUtService.pageBuild(
				() -> this.txzldpCommonViewRepository.queryQlDetail(param), param));
    }
	
	@GetMapping("queryDeptDetail")
    @ApiOperation(value = "单位维度明细", notes = "")
    @ApiImplicitParams({
    })
    public Resp queryDeptDetail(
    		@RequestParam(required = false) Map<String,String> param
    		){
		return Resp.success(this.rptUtService.pageBuild(
				() -> this.txzldpCommonViewRepository.queryDeptDetail(param), param));
    }
}